package com.yadong.smarthome2.connections;

import com.yadong.smarthome2.connections.Connection.ConnectionListener;
import com.yadong.smarthome2.device.Device;
import com.yadong.smarthome2.messageparser.RequestManager;

public class ConnectionFactory {
    public static Connection createConnection(Device device, ConnectionListener listener,
            MessageSendThread messageSendThread, RequestManager requestManager,
            ResultListener resultListener) {
        switch (device.getDeviceConnectionType()) {
            case WIFI:
                return new WifiConnection(device, listener,
                        messageSendThread, requestManager, resultListener);
            case WIFIP2P:
                return new WifiP2PCoonnection(device, listener,
                        messageSendThread, requestManager, resultListener);
            case BLUETOOTH:
                return new BluetoothConnection(device, listener,
                        messageSendThread, requestManager, resultListener);
            default:
                break;
        }
        return null;
    }
}
